<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Material of Analysis | 起步</title>
    <meta name="description" content="The analytical data that you often use to learn">
    <link rel="icon" href="/material/logo.png">
  <link rel="manifest" href="/material/manifest.json">
  <meta name="theme-color" content="#3eaf7c">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <link rel="apple-touch-icon" href="/material/icons/apple-touch-icon-152x152.png">
  <link rel="mask-icon" href="/material/icons/safari-pinned-tab.svg" color="#3eaf7c">
  <meta name="msapplication-TileImage" content="/icons/msapplication-icon-144x144.png">
  <meta name="msapplication-TileColor" content="#000000">
    
    <link rel="preload" href="/material/assets/css/0.styles.89749010.css" as="style"><link rel="preload" href="/material/assets/js/app.671f232e.js" as="script"><link rel="preload" href="/material/assets/js/4.b8a50edf.js" as="script"><link rel="prefetch" href="/material/assets/js/9.6ad28882.js"><link rel="prefetch" href="/material/assets/js/1.a893eea4.js"><link rel="prefetch" href="/material/assets/js/2.ad32dd32.js"><link rel="prefetch" href="/material/assets/js/3.2af42d2c.js"><link rel="prefetch" href="/material/assets/js/5.3a34f633.js"><link rel="prefetch" href="/material/assets/js/6.36baf8b1.js"><link rel="prefetch" href="/material/assets/js/7.23741c7b.js"><link rel="prefetch" href="/material/assets/js/8.0b506f6a.js"><link rel="prefetch" href="/material/assets/js/10.aa5bc1f8.js"><link rel="prefetch" href="/material/assets/js/11.b5d01b0b.js"><link rel="prefetch" href="/material/assets/js/12.2aab57fe.js"><link rel="prefetch" href="/material/assets/js/13.17c8fcb3.js"><link rel="prefetch" href="/material/assets/js/14.b0d8de38.js"><link rel="prefetch" href="/material/assets/js/15.95c4b4d8.js"><link rel="prefetch" href="/material/assets/js/16.8279b098.js"><link rel="prefetch" href="/material/assets/js/17.c88c3a9c.js"><link rel="prefetch" href="/material/assets/js/18.0635186f.js"><link rel="prefetch" href="/material/assets/js/19.5e722a99.js">
    <link rel="stylesheet" href="/material/assets/css/0.styles.89749010.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container no-sidebar"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div><a href="/material/" class="home-link router-link-active"><!----><span class="site-name">
      Material of Analysis
    </span></a><div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""><!----></div><nav class="nav-links can-hide"><div class="nav-item"><a href="/material/basic/" class="nav-link">基础</a></div><a href="https://github.com/docschina/vuepress" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav></div></header><div class="sidebar-mask"></div><div class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/material/basic/" class="nav-link">基础</a></div><a href="https://github.com/docschina/vuepress" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav><!----></div><div class="page"><div class="content"><h1 id="起步"><a href="#起步" aria-hidden="true" class="header-anchor">#</a> 起步</h1><div class="warning custom-block"><p class="custom-block-title">兼容性注意事项</p><p>VuePress 要求 Node.js &gt;= 8。</p></div><h2 id="全局安装"><a href="#全局安装" aria-hidden="true" class="header-anchor">#</a> 全局安装</h2><p>如果你只是想随便用下 VuePress，你可以在全局安装它：</p><pre class="language-bash"><code><span class="token comment"># 全局安装</span>
yarn global add vuepress <span class="token comment"># 或 npm install -g vuepress</span>

<span class="token comment"># 创建一个 markdown 文件</span>
<span class="token keyword">echo</span> <span class="token string">'# Hello VuePress'</span> <span class="token operator">&gt;</span> README.md

<span class="token comment"># 开始编写文档</span>
vuepress dev

<span class="token comment"># 构建</span>
vuepress build
</code></pre><h2 id="在已有项目中安装"><a href="#在已有项目中安装" aria-hidden="true" class="header-anchor">#</a> 在已有项目中安装</h2><p>如果你想要在一个已有项目中维护文档，就应该将 VuePress 安装为本地依赖。此设置还允许你使用 CI 或 Netlify 服务，在推送时自动部署。</p><pre class="language-bash"><code><span class="token comment"># 安装为本地依赖项</span>
yarn add -D vuepress <span class="token comment"># 或 npm install -D vuepress</span>

<span class="token comment"># 创建一个 docs 目录</span>
<span class="token function">mkdir</span> docs
<span class="token comment"># 创建一个 markdown 文件</span>
<span class="token keyword">echo</span> <span class="token string">'# Hello VuePress'</span> <span class="token operator">&gt;</span> docs/README.md
</code></pre><div class="warning custom-block"><p class="custom-block-title">WARNING</p><p>It is currently recommended to use <a href="https://yarnpkg.com/en/" target="_blank" rel="noopener noreferrer">Yarn</a> instead of npm when installing VuePress into an existing project that has webpack 3.x as a dependency. Npm fails to generate the correct dependency tree in this case.</p></div><p>然后，给 <code>package.json</code> 添加一些 scripts 脚本：</p><pre class="language-json"><code><span class="token punctuation">{</span>
  <span class="token property">&quot;scripts&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
    <span class="token property">&quot;docs:dev&quot;</span><span class="token operator">:</span> <span class="token string">&quot;vuepress dev docs&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;docs:build&quot;</span><span class="token operator">:</span> <span class="token string">&quot;vuepress build docs&quot;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre><p>你现在就可以开始编写文档了：</p><pre class="language-bash"><code>yarn docs:dev <span class="token comment"># 或 npm run docs:dev</span>
</code></pre><p>要生成静态资源，请运行：</p><pre class="language-bash"><code>yarn docs:build <span class="token comment"># 或 npm run docs:build</span>
</code></pre><p>默认情况下，构建的文件会位于 <code>.vuepress/dist</code> 中，该文件可以通过 <code>.vuepress/config.js</code> 中的 <code>dest</code> 字段进行配置。构建的文件可以部署到任何静态文件服务器。关于如何部署到一些常用服务，请参考 <a href="/material/guide/deploy.html">部署指南</a>。</p><hr><blockquote><p>原文：<a href="https://vuepress.vuejs.org/guide/getting-started.html" target="_blank" rel="noopener noreferrer">https://vuepress.vuejs.org/guide/getting-started.html</a></p></blockquote><hr></div><div class="content edit-link"><a href="https://github.com/docschina/vuepress/edit/master/docs/guide/getting-started.md" target="_blank" rel="noopener noreferrer">在GitHub上编辑此页</a><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></div><!----></div></div></div>
    <script src="/material/assets/js/4.b8a50edf.js" defer></script><script src="/material/assets/js/app.671f232e.js" defer></script>
  </body>
</html>
